/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.data.ui.swing;

import e.odbo.data.bean.IKeyed;
import e.odbo.data.dao.I_DataLogic;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Administrator
 */
public abstract class AbstractRefDTOTableModel<T> extends AbstractDTOTableModel<T>{
     protected I_DataLogic dataLogic;
     protected Map<Class,List> refObjMap;

    public AbstractRefDTOTableModel(I_DataLogic dataLogic) {
        super();
        this.dataLogic = dataLogic;
        refObjMap=new HashMap();
        initRefMap(refObjMap);
    }

    public abstract void initRefMap(Map<Class,List> refObjMap);

    public Object getRefObj(Class c,String id){
        List<IKeyed<String>> objList=refObjMap.get(c);
        for(IKeyed<String> obj:objList)
            if(obj.getKey().equals(id))
                return obj;
        return null;
    }
}
